<?php

use app\components\BaseGridView;
use app\models\Banner;
use yii\helpers\Url;

/* @var $dataProvider \yii\data\ActiveDataProvider */
/* @var $model Banner */

?>

<?= \admin\widgets\AdminTabs::widget([
    'items' => Banner::getTypeLabels(),
    'id' => 'type',
    'all' => FALSE,
    'defaultValue' => Banner::TYPE_POST
]); ?>

<?= \admin\widgets\AdminToolbar::widget([]); ?>

<div class="row">
    <?php $models = $dataProvider->getModels(); ?>
    <?php foreach ($models as $model): ?>
        <div class="col-md-3">
            <div class="thumbnail">
                <a href="<?= $model->url ? $model->url : $model->image; ?>" target="_blank">
                    <img src="<?= $model->image; ?>">
                </a>
                <div style="margin:10px 0;">
                    <a href="<?= Url::to(['delete', 'id' => $model->id]); ?>" class="btn danger delete" role="button">删除</a>
                    <a href="<?= Url::to(['save', 'id' => $model->id]); ?>" class="btn dialog" role="button">修改</a>
                </div>
            </div>

        </div>
    <?php endforeach; ?>
</div>
